package client;

import javax.swing.*;
import java.awt.*;
import java.sql.ResultSet;
import java.util.LinkedList;

public class Cvdisplay {
    private static Cvdisplay disp=null;
    private JPanel pane=null;
    public static JPanel getPanel(LinkedList<String> sql) {
        if(sql==null){
            System.out.println("sql is null.");
            disp=new Cvdisplay();
            return disp.pane;
        }
        disp=new Cvdisplay(sql);
        return disp.pane;
    }
    public static JPanel getPanel(){
        if(disp==null)
            disp=new Cvdisplay();
        return disp.pane;
    }
    private Cvdisplay(LinkedList<String>sql){
        pane=new JPanel();
        pane.setLayout(new GridLayout(sql.size(),1));
        int count = 0;
        for(String ss : sql){
            JLabel curL=new JLabel(ss);
            curL.setFont(Cview.dfon3);
            //curL.setBackground(Cview.dfblue2);
            curL.setSize(new Dimension(300,20));
            pane.add(curL);
            count++;
        }
        if(count<15)
            pane.setLayout(new GridLayout(15,1));
    }
    private Cvdisplay(){//无参构造函数
        pane=new JPanel();
        pane.setSize(new Dimension(300,600));
    }
}
